home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Cwd.Z / Cwd
Encoding:
Text File  |  1998-10-28  |  3.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      CCCCwwwwdddd((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        CCCCwwwwdddd((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       getcwd - get pathname    of current working directory
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           use Cwd;
  13.           $dir = cwd;
  14.  
  15.           use Cwd;
  16.           $dir = getcwd;
  17.  
  18.           use Cwd;
  19.           $dir = fastgetcwd;
  20.  
  21.           use Cwd 'chdir';
  22.           chdir "/tmp";
  23.           print $ENV{'PWD'};
  24.  
  25.           use Cwd 'abs_path';
  26.           print abs_path($ENV{'PWD'});
  27.  
  28.           use Cwd 'fast_abs_path';
  29.           print fast_abs_path($ENV{'PWD'});
  30.  
  31.  
  32.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  33.       The _g_e_t_c_w_d() function    re-implements the _g_e_t_c_w_d(3) (or
  34.       _g_e_t_w_d(3)) functions in Perl.
  35.  
  36.       The _a_b_s__p_a_t_h() function takes    a single argument and returns
  37.       the absolute pathname    for that argument. It uses the same
  38.       algoritm as _g_e_t_c_w_d().    (actually _g_e_t_c_w_d() is _a_b_s__p_a_t_h("."))
  39.  
  40.       The _f_a_s_t_c_w_d()    function looks the same    as _g_e_t_c_w_d(), but runs
  41.       faster.  It's    also more dangerous because it might
  42.       conceivably _c_h_d_i_r() you out of a directory that it can't
  43.       _c_h_d_i_r() you back into.  If fastcwd encounters    a problem it
  44.       will return undef but    will probably leave you    in a different
  45.       directory.  For a measure of extra security, if everything
  46.       appears to have worked, the _f_a_s_t_c_w_d()    function will check
  47.       that it leaves you in    the same directory that    it started in.
  48.       If it    has changed it will die    with the message "Unstable
  49.       directory path, current directory changed unexpectedly".
  50.       That should never happen.
  51.  
  52.       The _f_a_s_t__a_b_s__p_a_t_h() function looks the same as _a_b_s__p_a_t_h(),
  53.       but runs faster.  And    like _f_a_s_t_c_w_d() is more dangerous.
  54.  
  55.       The _c_w_d() function looks the same as getcwd and fastgetcwd
  56.       but is implemented using the most natural and    safe form for
  57.       the current architecture. For    most systems it    is identical
  58.       to `pwd` (but    without    the trailing line terminator).
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      CCCCwwwwdddd((((3333))))         22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))        CCCCwwwwdddd((((3333))))
  71.  
  72.  
  73.  
  74.       It is    recommended that cwd (or another *_c_w_d()    function) is
  75.       used in _a_l_l code to ensure portability.
  76.  
  77.       If you ask to    override your _c_h_d_i_r() built-in function, then
  78.       your PWD environment variable    will be    kept up    to date.  (See
  79.       the section on _O_v_e_r_r_i_d_i_n_g _B_u_i_l_t_i_n _F_u_n_c_t_i_o_n_s in the _p_e_r_l_s_u_b
  80.       manpage.) Note that it will only be kept up to date if all
  81.       packages which use chdir import it from Cwd.
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.